home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk54
/
plotxy
/
plotxy.doc
< prev
next >
Wrap
Text File
|
1995-03-18
|
14KB
|
301 lines
PlotXY Version 1.0
By
Robert Mack
Copyright, 1989
1 Introduction
------------
PlotXY is a 2-D plotting package that plots X and Y data points
from a file on several types of graphs. PlotXY was written completely
in C using the Manx Aztec V3.6a C compiler. PlotXY was compiled using
the +fi option for the IEEE Double Precision Floating Point Emulation
and linked using the mal32.lib for access to the Amiga's library.
There are several good plotting programs in the public domain,
but the majority of them accept only a mathematical function as
input (as far as I know). I wanted a plotting package that
accepted X and Y data points as input. I also wanted it to be very
flexible as far as the output was concerned. PlotXY allows the user
to define just about every aspect of the plot that I could think of.
The user can determine the type of graph (i.e. linear, linear-log,
log-linear, log-log, and histogram), the size of the graph (by input
or interactively), the color of the graph and data, the marker type,
the line type (although there are only 6 pre-defined types), annotation
and title, and the graph characteristics (i.e. X /Y bounds, major/minor
tick marks, grid, and overlay option). Also included are linear
regression analysis and polynomial fit analysis. All these options
are explained in detail section 3.
PlotXY is in the public domain. The author grants permission
to duplicate this software provided that no commercial gain can be
had as a consequence of use or reproduction of this software and
that this and other identifying information be left intact. The author
may not be held liable for the consequences of use or misuse of this
software.
2. How to get started using PlotXY
I've provided several example input files so that you may
experiment PlotXY. The files are:
lotto.dat Frequency of the Maryland Lotto numbers
picked from the beginning to 01/14/89.
sine.dat The sine of 0 to 360.
tempf.dat The temperatures (degrees F)at Baltimore for
72 hours (I don't remember the dates...sometime
in the fall).
The following is an example of typical steps that are used
to plot a X/Y graph with PlotXY.
1) PLOTXY expects there to be a logical device "GDATA:", which
corresponds to the directory where the data for plotting is
located. This can be accomplished using the CLI "ASSIGN"
command (i.e., ASSIGN GDATA: DF1:Graphdata).
2) Open and read the data file. Choose the menu item OPEN
in the project menu. A file requester is presented for
selection.
3) Choose the graph type under the Graph Type menu.
4) Next choose the graph options you want under the Utilities
menu. The default is a point plot. You may also choose to
plot a line connecting the data points. The point, line, grid,
and overlay options can all be activated at the same time.
They are not mutually exclusive. If they are activated, a
check mark will appear be for an item. To turn them off, you
must reselect the item. The check mark will no longer be
displayed.
Setup may be activated to set up the graph characteristics.
If Setup is not picked at this point, it will be displayed
before the graph is plotted.
5) Choose the graph and background colors from the Color menu.
6) Plot the graph using the Draw item under the Project menu.
3. Description of Menu Items
3.1 Project Menu
------------
Draw - This menu item initiates the plotting of the graph. After
the user acknowledges that he/she wants to begin, a setup
window appears. This window allows the user to set up
different plot characteristics (see Setup menu item under
the Utilities menu for details). Note: This window will not
appear if the user has already chosen the plot's characteristics
using the setup menu item under Utilities.
Open - Open a text file containing n points to plot (max 1000). The
file must have the following format:
record 1 Number of points (integer)
record 2 X1 Y1
record 3 X2 Y2
. . .
. . .
record i Xn Yn
X and Y can be either floating point or integer. If you plan
on doing a line plot make sure the points are sorted. PlotXY
does NOT sort the points. A file requester will be presented
for file selection.
New - Erase the screen (plot) for a new plot. The file opened
previously is still active.
SaveIFF - Save the screen (plot) as an IFF file. A file requester
will appear for the user to enter the IFF file name.
Print - Print the screen (plot) to a dot matrix line printer. There
is an option to set the background color to white for
printing on a black and white dot matrix printer. (I've
never tried it on a color printer).
Credits - This item displays a window that gives credit for the
public domain routines that were used. Thank you.
Quit - Quit PlotXY.
3.2 Graph Type Menu
---------------
Linear - Indicates a linear graph is desired (default).
Linear-Log - Indicates a linear-log graph is desired.
Log-Linear - Indicates a log-linear graph is desired.
Log-Log - Indicates a log graph is desired.
Histogram - Indicates a histogram graph is desired.
3.3 Analysis Menu
-------------
Linear Regression - Linear regression allows you to analyze one
variable's relationship to another. The method
is to perform a least-squares linear regression
which is designed to minimize the sum of the
squares of the deviations of the actual data
points from the straight line of best fit. In
practice, a plot of the data points is made
and then a line is constructed (by selecting
the Linear Regression Item) that uniformly
divides the points. The data color and line
type is chosen at this point. The line is
described by y = mx + b, where m is the slope
of the line and b is the intercept. The
correlation coefficient, which is a measurement
of how well the line fitted to the data actually
does approximate the data, is also calculated.
These parameters are displayed in a separate
window.
Polynomial Fit - Polynomial fit uses a higher order polynomial
for a reasonably good representation of a series
of n data points (X,Y). The regression coefficients
are also estimated. The technique employs a
least-squares fit of the data by a polynomial of
order m, where m = 1,2,...10 (maximum of 10) and
examines the standard deviation s about the regression
line. The linear regression of Y upon a single
variable X can be extended to the multiple regression:
Y = a + b1X1 + b2x2 + ... + biXi + ... + bkXk,
where X1,X2,...,Xk are k different variables. If, as
frequently occurs, X1 = X, X2 = X**2, X3 = X**3, etc.,
we have a special case of multiple regression known as
polynomial or curvilinear regression.
After the data points have been plotted, select
the Polynomial Fit item under the Analysis menu.
The user is then prompted, via a string gadget, to
enter the order of the polynomial that will be used.
The color and line type are also selected. A curve
is then plotted on the graph. A separate window is
presented that displays: 1) the polynomial order,
2)the standard deviation, 3) the coefficient a, and
4) each bk regression coefficient.
3.4 Utilities Menu
--------------
Point - Plot a character marker for the data point (default).
Line - Plot a line connecting the data points.
Grid - Plot a dashed grid at the major tick marks on the
background.
Overlay - This option is used to overlay data from a different
file onto the previous graph. If this item is picked,
the previous options remain. All that is plotted are
the new data.
Setup - Setup opens a window with gadgets that allow the user
to change the graph characteristics. The following is
a list of graph characteristics that can be changed:
Graph Bounds (float)
------------------
XMAX - X maximum
XMIN - X minimum
YMAX - Y maximum
YMIN - Y minimum
Initially the graph bounds default to the X and Y data bounds
(X and Y minimum and maximum). Log plots default to
XMAX and YMAX = 1000.0 and XMIN and YMIN = 1.0.
Tick marks (integer)
--------------------
XMAJ - major tick marks along the X axis. Default is 5.
YMAJ - major tick marks along the Y axis. Default is 5.
XMINOR - minor tick marks along the X axis. Default is 5.
YMINOR - minor tick marks along the Y axis. Default is 5.
Box size (float)
---------------
XUL - The pixel upper left hand corner of the graph.
YUL - The line upper left hand corner of the graph.
Width - The graph width.
Height - The graph height.
Features
--------
Marker type - The marker type specifies what character is
drawn to mark the data point. The default is
"+". WARNING: The character font I use is
the Siesta.font (Microsmiths). I adjusted the
X and Y for the TEXT command to make the
characters draw so that the data point is
at the middle of the character. I checked the
default Topaz font and it looks okay, but other
fonts may not be centered. If this is a problem,
let me know. I use the Siesta font because it
looks the best (IMHO).
Data color - Change the color for the data. Default is green.
See color menu for default colors.
Precision - Precision is the number of decimal places that
are plotted to the left of the decimal point
(i.e. 0 plots integer). The default is 1.
Line pattern - Change the line pattern. The line option must
be active. The default is a solid line.
Box Mode - Enables the user to shape and move the graph box
interactively via the mouse. Menu options control
whether the box is being sized (shaped) or moved.
Use the left mouse button to define the box. Initially
this option is set to shape the box. Exit when you
are satisfied with the size and location.
Filter - This option does a running mean on the Y data to
perform a smoothing. Enter the number of Y data points
to use in the running mean. The data points must be sorted.
Annotate - This option allows the user to write text for the plot.
A string gadget is presented for input of a character
string of up to a maximum of 132 characters. Move the
text with the mouse to the location desired. Define
the location by pressing the left mouse button.
Title - This option lets the user write a title in the window's
title bar. The string may be up to a maximum of 132
characters.
3.5 Colors - default colors: black, blue, green, cyan, red, magenta,
------ yellow, and white.
Background - Set the background color by selecting the appropriate
box (default: black).
Foreground - Set the graph color by selecting the box (default: blue).
Palette - Make your own palette by using C. Heath's public domain
palette tool.
4.0 Remarks
-------
PlotXY is my first program that I have released as public domain.
I've learned how to program in C on my Amiga writing PlotXY and other
programs. Therefore, I am very interested in any comments, suggestions,
and complaints that you may have. Please let me here from you. I can
be reached on BIX as RMACK or PLINK as OTR763. You can also write
me:
Bob Mack
13909 Briarwod Drive Apt. 312
Laurel, Maryland 20708